//Begin function hover .inner_tb table
$(function() {	
	$(".inner_tb table").hover(function() {
		$(this).addClass("roll-hover");
	}, function() {
		$(this).removeClass("roll-hover");
	});
});
//End function hover .inner_tb table

//Begin function hover .hover tr
$(function() {	
	$(".nohover").hover(function() {
		$(this).addClass("roll-hover2");
	}, function() {
		$(this).removeClass("roll-hover2");
	});
});
//End function hover .nohover tr

jQuery.fn.extend({
	slideText:function(options){
		this.settings = jQuery.extend( {
		  cmd : 'slideUp',
		  duration:1000,
		  timeSlide:4000,
		  height:28
		} , options);
		var o=this;
		switch(this.settings.cmd){
			case 'slideUp':	
							jQuery(o).find('li').each(function(){
								jQuery(this).css({listStyle:'none',lineHeight:o.settings.height+'px'})				   
							});
							jQuery(o).css({height:o.settings.height+'px',overflow:'hidden',margin:0,padding:0});	
							setInterval(function(){
							jQuery(o).find('li').each(function(){
								jQuery(this).css({listStyle:'none',lineHeight:o.settings.height+'px',height:o.settings.height})				   
							});
							jQuery(o).css({height:o.settings.height+'px',overflow:'hidden'});					 
							jQuery(o).find('li:first').animate( {marginTop: '-'+o.settings.height+'px'}, o.settings.duration, function(){
								jQuery(this).detach().appendTo(o).removeAttr('style');	
							});			 
							},this.settings.timeSlide); 
							break;
			case 'slideDown':	
							jQuery(o).css({height:o.settings.height+'px',overflow:'hidden',margin:0,padding:0});	
							var li2=jQuery(o).find('li').eq(1);
							li2.css({marginTop:'-'+o.settings.height+'px'});
							var tmp=li2.html();
							var style_text=li2.attr('style');
							li2.remove();
							jQuery(o).find('li:first').before('<li'+(style_text?' style="'+style_text+'"':'')+'>'+tmp+'</li>');
							jQuery(o).find('li').each(function(){
								jQuery(this).css({listStyle:'none',lineHeight:o.settings.height+'px',height:o.settings.height});			   
							});
					
							setInterval(function(){
							jQuery(o).find('li').each(function(){
								jQuery(this).css({listStyle:'none',lineHeight:o.settings.height+'px',height:o.settings.height})				   
							});
							jQuery(o).find('li:first').css({marginTop:'-'+o.settings.height+'px'});
							jQuery(o).find('li:first').animate( {marginTop: 0}, 
															   o.settings.duration, 
															   function(){
																   jQuery(o).find('li').eq(1).detach().appendTo(o);	
																   jQuery(o).css({height:o.settings.height+'px',overflow:'hidden'});
																
																	var li2=jQuery(o).find('li').eq(1);
																	li2.css({marginTop:'-'+o.settings.height+'px'});
																	var tmp=li2.html();
																	var style_text=li2.attr('style');
																	li2.remove();																																																			
																	jQuery(o).find('li:first').before('<li'+(style_text?' style="'+style_text+'"':'')+'>'+tmp+'</li>');																																																																																									  																});
				
							},this.settings.timeSlide);
							break;
		}
	}
});
/*
jQuery(function(){
	jQuery('#slide').slideText();		
	jQuery('#slideAnnounce').slideText({cmd:'slideDown'});	
});
*/
$(function(){
	var $scroller = $("#Announce");
	$scroller.vTicker('init', {height: 28, showItems: 1});
	
	$(".annnext").click(function(){ 
			$scroller.vTicker('next', {animate:true});
		});
	$(".annprev,.annnext").hover(function(){ 
			$scroller.vTicker('pause', true);
		}, function(){
			$scroller.vTicker('pause', false);
	});
	$(".annprev").click(function(){ 
			$scroller.vTicker('prev', {animate:true});
		});
});

		$(document).ready(function(){
			$(".modal6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
			$(".loginbtn").colorbox({width:"500px;", height:"245px;", inline:true, href:"#login"});
			
		});

		function call_cbox(elm)
		{
		   jQuery().colorbox({html:elm});
		   $('#cboxOverlay,#colorbox').hide().show("fold", { direction: "vertical" }, 1000);
		}
	  /*
	  $(function() {
		$('.tips').tipsy({fade: true,gravity: 's'});
		$('.tipe').tipsy({fade: true,gravity: 'e'});
		$('.tipw').tipsy({fade: true,gravity: 'w'});
		$('.tipn').tipsy({fade: true,gravity: 'n'});
		});
		*/

	function answerbox(msg,url){
		$.msgbox(msg, {type: "confirm",buttons : [{type: "submit", value: "Yes"},{type: "submit", value: "No"}]}, 
		function(result) { 
		if(result=="Yes"){
		window.location.href=url; 
		}else{
			
		}
		});
	}
	function alertbox(msg){
	$.msgbox("<font color='red' style='font-size:20px;'>"+msg+"</font>");
	}
	
	jQuery(function(){
    var screenHeight=jQuery(window).height(); 
    jQuery('.adv').each(function(){ 
        var adv_height=jQuery(this).outerHeight(); 
        var align=(screenHeight-adv_height)/1.9; 
        jQuery(this).css({marginTop:+'5px'}); 
    });
    jQuery(window).scroll(function(){ 
        var scrollTop=jQuery(this).scrollTop(); 
        jQuery('.adv').each(function(){
            var adv_height=jQuery(this).outerHeight();
            var align=(screenHeight-adv_height)/1.9;
            jQuery(this).stop(); 
            jQuery(this).animate({
                marginTop: scrollTop+25 
              }, 500, function() { 
 
                            });
        });
    });
    jQuery('.adv_closess').click(function(){ 
            jQuery(window).unbind('scroll'); 
            jQuery('.adv').hide(500, 
                                 function(){
                jQuery(this).remove();
            });
    });
});

$(function(){
  $("#loadings").show();
});

$(window).load(function(){
  $("#loadings").fadeOut();
  //$("#page_controler").slideDown(1000);
});
/*
document.write( unescape( '%3C%73%63%72%69%70%74%20%6C%61%6E%67%75%61%67%65%3D%22%6A%61%76%61%73%63%72%69%70%74%22%3E%0A%76%61%72%20%69%6E%74%65%72%76%61%6C%44%6F%77%6E%31%3B%0A%66%75%6E%63%74%69%6F%6E%20%70%6C%61%79%73%63%72%6F%6C%6C%5F%64%6F%77%6E%28%29%7B%0A%09%69%6E%74%65%72%76%61%6C%44%6F%77%6E%31%20%3D%20%73%65%74%49%6E%74%65%72%76%61%6C%28%66%75%6E%63%74%69%6F%6E%28%29%20%7B%0A%09%09%76%61%72%20%79%20%3D%20%24%28%77%69%6E%64%6F%77%29%2E%73%63%72%6F%6C%6C%54%6F%70%28%29%3B%0A%09%09%24%28%77%69%6E%64%6F%77%29%2E%73%63%72%6F%6C%6C%54%6F%70%28%79%2B%31%29%3B%0A%09%7D%2C%20%32%35%29%3B%0A%09%24%28%22%23%70%6C%61%79%5F%64%6F%77%6E%22%29%2E%72%65%70%6C%61%63%65%57%69%74%68%28%27%3C%69%6D%67%20%74%69%74%6C%65%3D%22หยุด%22%20%69%64%3D%22%70%6C%61%79%5F%64%6F%77%6E%22%20%6F%6E%63%6C%69%63%6B%3D%22%6A%61%76%61%73%63%72%69%70%74%3A%73%74%6F%70%53%63%72%6F%6C%6C%28%29%3B%22%20%73%72%63%3D%22%2F%69%6D%67%2F%62%74%68%5F%73%63%72%6F%6C%6C%5F%63%6F%6E%74%72%6F%6C%65%72%2F%73%74%6F%70%73%63%72%6F%6C%6C%2E%70%6E%67%22%20%77%69%64%74%68%3D%22%33%38%22%20%68%65%69%67%68%74%3D%22%33%38%22%20%3E%27%29%3B%0A%09%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A%7D%0A%66%75%6E%63%74%69%6F%6E%20%73%74%6F%70%53%63%72%6F%6C%6C%28%29%7B%0A%09%63%6C%65%61%72%49%6E%74%65%72%76%61%6C%28%69%6E%74%65%72%76%61%6C%44%6F%77%6E%31%29%3B%0A%09%24%28%22%23%70%6C%61%79%5F%64%6F%77%6E%22%29%2E%72%65%70%6C%61%63%65%57%69%74%68%28%27%3C%69%6D%67%20%74%69%74%6C%65%3D%22ค่อยๆเลื่อนลง%22%20%69%64%3D%22%70%6C%61%79%5F%64%6F%77%6E%22%20%6F%6E%63%6C%69%63%6B%3D%22%6A%61%76%61%73%63%72%69%70%74%3A%70%6C%61%79%73%63%72%6F%6C%6C%5F%64%6F%77%6E%28%29%3B%22%20%73%72%63%3D%22%2F%69%6D%67%2F%62%74%68%5F%73%63%72%6F%6C%6C%5F%63%6F%6E%74%72%6F%6C%65%72%2F%73%63%72%6F%6C%6C%5F%70%6C%61%79%5F%62%74%6E%2E%70%6E%67%22%20%77%69%64%74%68%3D%22%33%38%22%20%68%65%69%67%68%74%3D%22%33%38%22%20%3E%27%29%3B%0A%7D%0A%66%75%6E%63%74%69%6F%6E%20%67%6F%64%6F%77%6E%28%29%7B%0A%09%24%28%27%62%6F%64%79%2C%68%74%6D%6C%27%29%2E%61%6E%69%6D%61%74%65%28%7B%20%73%63%72%6F%6C%6C%54%6F%70%3A%20%24%28%64%6F%63%75%6D%65%6E%74%29%2E%68%65%69%67%68%74%28%29%20%7D%2C%27%73%6C%6F%77%27%29%3B%0A%09%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A%7D%0A%66%75%6E%63%74%69%6F%6E%20%67%6F%74%6F%70%28%29%20%7B%0A%09%63%6C%65%61%72%49%6E%74%65%72%76%61%6C%28%69%6E%74%65%72%76%61%6C%44%6F%77%6E%31%29%3B%0A%09%24%28%27%62%6F%64%79%2C%68%74%6D%6C%27%29%2E%61%6E%69%6D%61%74%65%28%7B%20%73%63%72%6F%6C%6C%54%6F%70%3A%20%30%20%7D%2C%27%73%6C%6F%77%27%29%3B%0A%09%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A%7D%0A%66%75%6E%63%74%69%6F%6E%20%67%6F%62%61%63%6B%70%61%67%65%28%29%7B%0A%20%20%20%20%70%61%72%65%6E%74%2E%68%69%73%74%6F%72%79%2E%62%61%63%6B%28%29%3B%0A%20%20%20%20%72%65%74%75%72%6E%20%66%61%6C%73%65%3B%0A%7D%0A%3C%2F%73%63%72%69%70%74%3E' ) );
*/